package com.gxa.service.gouhuoservice.Impl;

import com.gxa.common.R;
import com.gxa.mapper.gouhuomapper.GongYingShang46Mapper;
import com.gxa.pojo.GongYingShang;
import com.gxa.pojo.KeHuType;
import com.gxa.service.gouhuoservice.GongYingShang46Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class GongYingShang46ImplService implements GongYingShang46Service {

    @Autowired
    private GongYingShang46Mapper gongYingShang46Mapper;

    @Override
    public R selectByGouHuoDan( String shangPin, String cangKu) {

        R r = new R();
      /*  List<GouHuo> gouHuoList = gouHuoMapper.selectgou_huo(shangPin,cangKu);
        if (gouHuoList !=null){
            r.setCode(200);
            r.setMsg("success");
            r.setData(gouHuoList);
        }*/
        r.setCode(200);
        r.setMsg("success");
        return r;
    }

    @Override
    public R selectAllGongYingShangForPage(int page, int size) {

        R r = new R();
        int index = (page - 1)*size;
        List<GongYingShang> gongYingShangs = gongYingShang46Mapper.selectAllGongYingShangForPage(index,size);
        if (gongYingShangs != null){
            r.setCode(200);
            r.setMsg("查询成功！");
            r.setData(gongYingShangs);
        }
        return r;
    }

    public R selectAllGongYinShang(int currentPage, int pageSize, String gongYingShangTypeld, String gongYingShangNumber,
                                   String gongYingShangMingCheng, String lianXiRen, String phone) {

        R r = new R();
        int index = (currentPage - 1)*pageSize;
        List<GongYingShang> gongYingShangs = gongYingShang46Mapper.selectAllGongYinShang(index,pageSize,gongYingShangTypeld,
                gongYingShangNumber, gongYingShangMingCheng , lianXiRen, phone);

        if (gongYingShangs != null){
            r.setCode(200);
            r.setMsg("查询成功！");
            r.setData(gongYingShangs);
        }
        return r;
    }


//    public R selectAllGongYingShang() {
//        R r = new R();
//        r.setCode(200);
//        r.setMsg("查询成功！");
//        List<GongYingShang> gongYingShangs = gongYingShangMapper.selectAllGongYingShang();
//        r.setCount(gongYingShangMapper.selectCountGongYingShang());
//        r.setData(gongYingShangs);
//        return r;
//    }




}
